package entity;

import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Data
public class EmployeeChange {

    public static final int REVIEW_STATUS_PENDING = 0;   // 待审核
    public static final int REVIEW_STATUS_APPROVED = 1;  // 已审核
    public static final int REVIEW_STATUS_REJECTED = 2;  // 驳回

    private Long empChangeId;                           // 变更记录ID
    private Long empId;                                 // 员工ID
    private Long createUserId;                          // 创建人ID
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;                            // 创建时间
    private Integer reviewStatus;                       // 审核状态
    private Long reviewUserId;                          // 审核人ID
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date reviewTime;                            // 审核时间

    /**
     * 构造函数
     */
    public EmployeeChange() {
        this.createTime = new Date();
    }

    /**
     * 获取审核状态描述
     */
    public String getReviewStatusDesc() {
        if (reviewStatus == null) return "未知";
        return switch (reviewStatus) {
            case REVIEW_STATUS_PENDING -> "待审核";
            case REVIEW_STATUS_APPROVED -> "已审核";
            case REVIEW_STATUS_REJECTED -> "已驳回";
            default -> "未知";
        };
    }
}